package item9;

import java.text.DecimalFormat;

public class TT {
	static public void SimgleFormat(String pattern, double value) {
		DecimalFormat myFormat = new DecimalFormat(pattern);
		String output = myFormat.format(value);
		System.out.println(output);
	}

	static public void UseApplyPatternMethodFormat(String pattern, double value) {
		DecimalFormat myFormat = new DecimalFormat();
		myFormat.applyPattern(pattern);
		System.out.println(value + "" + pattern + "" + myFormat.format(value));
	}

	public static void main(String[] args) {
		SimgleFormat("###,###.###", 1234567.89);
		SimgleFormat("#.###%", 0.789);
		UseApplyPatternMethodFormat("###.##", 1234567.789);
	}
}
